<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="avaliacaoItem" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{avaliacaoItemHome.managed ? 'Edit' : 'Add'} Avaliacao item</f:facet>


            <s:decorate id="idtAvaliacaoItemField" template="layout/edit.xhtml">
                <ui:define name="label">Idt avaliacao item</ui:define>
                <h:inputText id="idtAvaliacaoItem"
                       required="true"
                       disabled="#{avaliacaoItemHome.managed}"
                          value="#{avaliacaoItemHome.instance.idtAvaliacaoItem}">
                    <a:support event="onblur" reRender="idtAvaliacaoItemField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>




            <s:decorate id="numNotaField" template="layout/edit.xhtml">
                <ui:define name="label">Num nota</ui:define>
                <h:inputText id="numNota"
                       required="true"
                          value="#{avaliacaoItemHome.instance.numNota}">
                    <a:support event="onblur" reRender="numNotaField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{avaliacaoItemHome.persist}"
                       disabled="#{!avaliacaoItemHome.wired}"
                       rendered="#{!avaliacaoItemHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{avaliacaoItemHome.update}"
                       rendered="#{avaliacaoItemHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{avaliacaoItemHome.remove}"
                      immediate="true"
                       rendered="#{avaliacaoItemHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/AvaliacaoItem.xhtml"
                rendered="#{avaliacaoItemHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty avaliacaoItemFrom ? 'AvaliacaoItemList' : avaliacaoItemFrom}.xhtml"
                rendered="#{!avaliacaoItemHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Avaliacao *" labelClass="required">
    <div class="association" id="avaliacaoParent">

        <h:outputText value="There is no avaliacao associated with this avaliacaoItem."
                   rendered="#{avaliacaoItemHome.instance.avaliacao == null}"/>

        <rich:dataTable var="_avaliacao"
                   value="#{avaliacaoItemHome.instance.avaliacao}"
                rendered="#{avaliacaoItemHome.instance.avaliacao != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="avaliacaoTable">
            <h:column>
                <f:facet name="header">Idt avaliacao</f:facet>
                <h:outputText value="#{_avaliacao.idtAvaliacao}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Disciplina idt disciplina</f:facet>
                <h:outputText value="#{_avaliacao.disciplina.idtDisciplina}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Turma idt turma</f:facet>
                <h:outputText value="#{_avaliacao.turma.idtTurma}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Cod avaliacao</f:facet>
                <h:outputText value="#{_avaliacao.codAvaliacao}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{avaliacaoItemHome.instance.avaliacao != null ? 'changeParent' : 'selectParent'}" value="#{avaliacaoItemHome.instance.avaliacao != null ? 'Change' : 'Select'} avaliacao"
                       view="/AvaliacaoList.xhtml">
                <f:param name="from" value="AvaliacaoItemEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Aluno *" labelClass="required">
    <div class="association" id="alunoParent">

        <h:outputText value="There is no aluno associated with this avaliacaoItem."
                   rendered="#{avaliacaoItemHome.instance.aluno == null}"/>

        <rich:dataTable var="_aluno"
                   value="#{avaliacaoItemHome.instance.aluno}"
                rendered="#{avaliacaoItemHome.instance.aluno != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="alunoTable">
            <h:column>
                <f:facet name="header">Idt aluno</f:facet>
                <h:outputText value="#{_aluno.idtAluno}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Dat nascimento</f:facet>
                <h:outputText value="#{_aluno.datNascimento}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Nom aluno</f:facet>
                <h:outputText value="#{_aluno.nomAluno}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Num cpf</f:facet>
                <h:outputText value="#{_aluno.numCpf}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Num ra</f:facet>
                <h:outputText value="#{_aluno.numRa}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Num rg</f:facet>
                <h:outputText value="#{_aluno.numRg}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{avaliacaoItemHome.instance.aluno != null ? 'changeParent' : 'selectParent'}" value="#{avaliacaoItemHome.instance.aluno != null ? 'Change' : 'Select'} aluno"
                       view="/AlunoList.xhtml">
                <f:param name="from" value="AvaliacaoItemEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
